//
//  LTabbarViewController.m
//  23-HomeworkPlanet
//
//  Created by dllo on 16/8/13.
//  Copyright © 2016年 LST. All rights reserved.
//

#import "LTabbarViewController.h"
#import "FinsViewController.h"
#import "MediaViewController.h"
#import "StoreViewController.h"
#import "MineViewController.h"
@interface LTabbarViewController ()

@end

@implementation LTabbarViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self creatTabBar];
}

-(void)creatTabBar{
    FinsViewController *fins = [[FinsViewController alloc] init];
    MediaViewController *media = [[MediaViewController alloc] init];
    StoreViewController *store = [[StoreViewController alloc] init];
    MineViewController *mine = [[MineViewController alloc] init];
    [self addChildVC:fins Title:@"粉丝游乐" Image:@"Unknown" SeleImage:@"Unknown"];
    [self addChildVC:media Title:@"天天视听" Image:@"视听" SeleImage:@"视听"];
    [self addChildVC:store Title:@"星球商城" Image:@"商城" SeleImage:@"商城"];
    [self addChildVC:mine Title:@"我的星球" Image:@"我的" SeleImage:@"我的"];
    
}
-(void)addChildVC:(UIViewController *)childVC
            Title:(NSString *)title
            Image:(NSString *)image
        SeleImage:(NSString *)seleImage
{
    UINavigationController *caChat = [[UINavigationController alloc] initWithRootViewController:childVC];
    childVC.title = title;
    childVC.tabBarItem.image = [UIImage imageNamed:image];
    childVC.tabBarItem.selectedImage = [[UIImage imageNamed:seleImage]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    NSMutableDictionary *dicThree = [NSMutableDictionary dictionary];
    dicThree[NSForegroundColorAttributeName] = [UIColor greenColor];
    
    NSMutableDictionary *dicFour = [NSMutableDictionary dictionary];
    dicFour[NSForegroundColorAttributeName] = [UIColor redColor];
    
    [childVC.tabBarItem setTitleTextAttributes:dicThree forState:UIControlStateNormal];
    [childVC.tabBarItem setTitleTextAttributes:dicFour forState:UIControlStateSelected];
    [self addChildViewController:caChat];
}





- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
